import matplotlib.pyplot as plt

# 用于处理中文
plt.rcParams['font.sans-serif'] = ['SimHei']

"""
坐标轴的刻度线：
    设置是否显示坐标轴刻度线：
        matplotlib.pyplot.tick_params(bottom, left, right, top)
        
    matplotlib.pyplot.rcParams[‘xtick.direction’]=’in’
    matplotlib.pyplot.rcParams[‘ytick.direction’]=’in’
"""

x = [1, 2, 3, 4, 5, 6]
y = [10, 45, 35, 46, 7, 67]
plt.plot(x, y, marker='o')

# 添加文本标签
for a, b in zip(x, y):
    plt.text(a, b, b, ha='center', va='bottom', fontsize=12, color='r')

# 添加文本注释
plt.annotate('最大数', xy=(4, 46), xytext=(5, 46), arrowprops=dict(facecolor='r', shrink=0.05))

# 设置间距
plt.subplots_adjust(left=0.2, right=0.9, top=0.9, bottom=0.2)

# 设置是否显示坐标轴刻度线：
# plt.tick_params(bottom=False, left=True, right=True, top=True)  # 下方的刻度线不显示

# 设置坐标轴刻度线显示的方向
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'

plt.show()
